﻿/*using System;
using System.Collections.Generic;
using EentitfFrameworkMvc.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.Extensions.Configuration;

namespace EentitfFrameworkMvc.Context
{
    //创建EF上下文
    public partial class Data01Context : DbContext
    {
        public virtual DbSet<TbStudent> TbStudent { get; set; }
        public Data01Context(DbContextOptions<Data01Context> options) : base(options)
        {
            
        }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)

        {
            //另一种配置连接数据库的方式
            //optionsBuilder.UseMySql("连接数据库", ServerVersion.AutoDetect("连接数据库字符串"));
            //optionsBuilder.UseSqlServer("DefaultConnection");
            optionsBuilder.UseSqlServer("Server=127.0.0.1;Database=db_data01;User ID=sa;Password=root;TrustServerCertificate=true;Trusted_Connection=True;MultipleActiveResultSets=true");
            //显示敏感数据日志
            optionsBuilder.EnableSensitiveDataLogging(true);
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<TbStudent>(entity =>
            {
                entity.HasKey(e => e.Sid)
                    .HasName("PK__tb_stude__DDDFDD36CB1006D0");

                entity.Property(e => e.Sname).IsUnicode(false);

                entity.Property(e => e.Spwd)
                    .IsUnicode(false)
                    .HasDefaultValueSql("('123456')");

                entity.Property(e => e.Ssex).IsUnicode(false);

                entity.Property(e => e.Ssf).IsUnicode(false);
            });

            OnModelCreatingPartial(modelBuilder);
        }

        partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
    }
}*/
